import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { withRouter } from 'react-router-dom';
import './index.less';
import { REGISTER_PATH } from '../../../constant';

class LoginFooter extends PureComponent {

  static propTypes = {
    history: PropTypes.object
  };

  // 跳转注册页面
  skipRegister = (event) => {
    event.preventDefault();
    const { history } = this.props;
    history.push(REGISTER_PATH);
  };

  // 微博登录
  weiboLogin = () => {
    window.location.href = 'https://api.weibo.com/oauth2/authorize?client_id=2387618014&response_type=code&redirect_uri=http://pan.wanjiahao.site/auth2/weibo/success';
  };

  render () {
    return (
      <>
        <div className="diy_login_other">
          <a href="/#">扫一扫登录</a>
          <a href="/#">
            <span className="weibo" onClick={this.weiboLogin}/>
            <span className="qq"/>
            <span className="weixin"/>
          </a>
          <a href="/#" onClick={this.skipRegister}>
            立即注册
          </a>
        </div>
      </>
    );
  }
}

export default withRouter(LoginFooter);
